﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:src="clr-namespace:WGM_Client_Net35"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    xmlns:WGM_Client_Net35_Properties="clr-namespace:WGM_Client_Net35.Properties"
    x:Class="WGM_Client_Net35.Window1"
    Title="WGM Beta" Height="396" Width="572" xmlns:Microsoft_Windows_Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" >
    <Window.Resources>      

        <DataTemplate x:Key="ContactListTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="4"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBlock FontWeight="Bold" Grid.ColumnSpan="2" TextTrimming="CharacterEllipsis" Text="{Binding Path=DisplayName}" ToolTip="{Binding Path=DisplayTooltip}" Foreground="{Binding Path=DisplayNameColour}" FontSize="14" FontFamily="Verdana">
                    <TextBlock.BitmapEffect>
                        <OuterGlowBitmapEffect GlowColor="LightGreen" GlowSize="10" x:Name="tbGlow" Opacity="0"/>
                    </TextBlock.BitmapEffect>
                </TextBlock>
                <TextBlock Visibility="{Binding Path=DisplayStatusVisiblity}" Grid.Column="1" Grid.Row="1" TextTrimming="CharacterEllipsis" Text="{Binding Path=DisplayStatus}" ToolTip="{Binding Path=DisplayTooltip}" Foreground="{Binding Path=DisplayNameColour}" FontFamily="Verdana" FontSize="10" FontStyle="Italic"/>
            </Grid>
        	<DataTemplate.Triggers>
                <DataTrigger Binding="{Binding Path=FlashContact}" Value="True"   >
                    <DataTrigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimationUsingKeyFrames Duration="00:00:01" AutoReverse="False" RepeatBehavior="3x" Storyboard.TargetName="tbGlow" Storyboard.TargetProperty="Opacity">
                                    <LinearDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                    <LinearDoubleKeyFrame KeyTime="00:00:0.5" Value="1"/>
                                    <LinearDoubleKeyFrame KeyTime="00:00:1" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
    	<ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}">
    		<ControlTemplate.Resources>
    			<Storyboard x:Key="FadScrollBarIn">
    				<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PART_VerticalScrollBar" Storyboard.TargetProperty="(UIElement.Opacity)">
    					<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.5"/>
    					<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
    				</DoubleAnimationUsingKeyFrames>
    			</Storyboard>
    			<Storyboard x:Key="FadeScrollBarOut">
    				<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="PART_VerticalScrollBar" Storyboard.TargetProperty="(UIElement.Opacity)">
    					<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
    					<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0.5"/>
    				</DoubleAnimationUsingKeyFrames>
    			</Storyboard>
    		</ControlTemplate.Resources>
    		<Grid x:Name="Grid" Background="{TemplateBinding Background}">
    			<Grid.ColumnDefinitions>
    				<ColumnDefinition Width="*"/>
    				<ColumnDefinition Width="Auto"/>
    			</Grid.ColumnDefinitions>
    			<Grid.RowDefinitions>
    				<RowDefinition Height="*"/>
    				<RowDefinition Height="Auto"/>
    			</Grid.RowDefinitions>
    			<Rectangle x:Name="Corner" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Column="1" Grid.Row="1"/>
    			<ScrollContentPresenter Margin="{TemplateBinding Padding}" x:Name="PART_ScrollContentPresenter" Grid.Column="0" Grid.Row="0" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
    			<ScrollBar Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Cursor="Arrow" x:Name="PART_VerticalScrollBar" Style="{DynamicResource ScrollBarStyle1}" Grid.Column="1" Grid.Row="0" ViewportSize="{TemplateBinding ViewportHeight}" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" AutomationProperties.AutomationId="VerticalScrollBar" Opacity="0.5"/>
    			<ScrollBar Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Cursor="Arrow" x:Name="PART_HorizontalScrollBar" Grid.Column="0" Grid.Row="1" Orientation="Horizontal" ViewportSize="{TemplateBinding ViewportWidth}" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Value="{Binding Path=HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" AutomationProperties.AutomationId="HorizontalScrollBar"/>
    		</Grid>
    		<ControlTemplate.Triggers>
    			<EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="PART_VerticalScrollBar">
    				<BeginStoryboard x:Name="FadScrollBarIn_BeginStoryboard" Storyboard="{StaticResource FadScrollBarIn}"/>
    			</EventTrigger>
    			<EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="PART_VerticalScrollBar">
    				<BeginStoryboard x:Name="FadeScrollBarOut_BeginStoryboard" Storyboard="{StaticResource FadeScrollBarOut}"/>
    			</EventTrigger>
    		</ControlTemplate.Triggers>
    	</ControlTemplate>
    	<Style x:Key="ScrollBarStyle1" TargetType="{x:Type ScrollBar}">
    		<Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
    		<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
    		<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}"/>
    		<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
    		<Setter Property="BorderThickness" Value="0,0,0,0"/>
    		<Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
    		<Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type ScrollBar}">
    					<Grid Width="14" Background="#00E2E2E2">
    						<Grid.RowDefinitions>
    							<RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
    							<RowDefinition Height="1E-05*"/>
    							<RowDefinition MaxHeight="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
    						</Grid.RowDefinitions>
    						<Viewbox Stretch="Fill" Opacity="0.5">
    							<RepeatButton MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Height="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}" Content="M 0 4 L 7 4 L 3.5 0 Z" Command="ScrollBar.LineUpCommand" Foreground="#FFFFFFFF" Background="#FF374862">
    								<RepeatButton.Style>
    									<Style TargetType="{x:Type RepeatButton}">
    										<Setter Property="OverridesDefaultStyle" Value="True"/>
    										<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
    										<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
    										<Setter Property="BorderBrush">
    											<Setter.Value>
    												<SolidColorBrush/>
    											</Setter.Value>
    										</Setter>
    										<Setter Property="BorderThickness" Value="2,2,2,2"/>
    										<Setter Property="MinWidth" Value="0"/>
    										<Setter Property="MinHeight" Value="0"/>
    										<Setter Property="IsTabStop" Value="False"/>
    										<Setter Property="Focusable" Value="False"/>
    										<Setter Property="Template">
    											<Setter.Value>
    												<ControlTemplate TargetType="{x:Type RepeatButton}">
    													<Microsoft_Windows_Themes1:ClassicBorderDecorator x:Name="ClassicBorder" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="AltRaised" BorderThickness="{TemplateBinding BorderThickness}">
    														<Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}"/>
    													</Microsoft_Windows_Themes1:ClassicBorderDecorator>
    													<ControlTemplate.Triggers>
    														<Trigger Property="IsPressed" Value="True">
    															<Setter Property="BorderStyle" TargetName="ClassicBorder" Value="AltPressed"/>
    														</Trigger>
    														<Trigger Property="IsEnabled" Value="False">
    															<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
    														</Trigger>
    													</ControlTemplate.Triggers>
    												</ControlTemplate>
    											</Setter.Value>
    										</Setter>
    									</Style>
    								</RepeatButton.Style>
    							</RepeatButton>
    						</Viewbox>
    						<Rectangle Grid.Row="1" Opacity="0" OpacityMask="#FF000000">
    							<Rectangle.Stroke>
    								<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    									<GradientStop Color="#FFE6E6E6" Offset="0"/>
    									<GradientStop Color="#FF072E49" Offset="1"/>
    								</LinearGradientBrush>
    							</Rectangle.Stroke>
    							<Rectangle.Fill>
    								<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    									<GradientStop Color="#FF7B90BD" Offset="0"/>
    									<GradientStop Color="#FF0F2045" Offset="1"/>
    								</LinearGradientBrush>
    							</Rectangle.Fill>
    						</Rectangle>
    						<Track x:Name="PART_Track" Grid.Row="1" IsDirectionReversed="True">
    							<Track.OpacityMask>
    								<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    									<GradientStop Color="#FFF2F9FD" Offset="0"/>
    									<GradientStop Color="#FF33607B" Offset="0.987"/>
    								</LinearGradientBrush>
    							</Track.OpacityMask>
    							<Track.Thumb>
    								<Thumb Background="#FFA86666">
    									<Thumb.Style>
    										<Style TargetType="{x:Type Thumb}">
    											<Setter Property="Template">
    												<Setter.Value>
    													<ControlTemplate TargetType="{x:Type Thumb}">
    														<Microsoft_Windows_Themes1:ClassicBorderDecorator BorderStyle="Raised" BorderThickness="3,3,3,3">
    															<Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
    																<SolidColorBrush/>
    															</Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
    															<Microsoft_Windows_Themes1:ClassicBorderDecorator.Background>
    																<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    																	<GradientStop Color="#FFD0DBE0" Offset="0"/>
    																	<GradientStop Color="#FF70A0B7" Offset="1"/>
    																</LinearGradientBrush>
    															</Microsoft_Windows_Themes1:ClassicBorderDecorator.Background>
    														</Microsoft_Windows_Themes1:ClassicBorderDecorator>
    													</ControlTemplate>
    												</Setter.Value>
    											</Setter>
    										</Style>
    									</Thumb.Style>
    								</Thumb>
    							</Track.Thumb>
    							<Track.IncreaseRepeatButton>
    								<RepeatButton Command="ScrollBar.PageDownCommand" Opacity="0">
    									<RepeatButton.Style>
    										<Style TargetType="{x:Type RepeatButton}">
    											<Setter Property="OverridesDefaultStyle" Value="True"/>
    											<Setter Property="IsTabStop" Value="False"/>
    											<Setter Property="Focusable" Value="False"/>
    											<Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
    											<Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
    											<Setter Property="Template">
    												<Setter.Value>
    													<ControlTemplate TargetType="{x:Type RepeatButton}">
    														<Rectangle x:Name="PageButtonBackground" Fill="#00FFFFFF"/>
    														<ControlTemplate.Triggers>
    															<Trigger Property="IsPressed" Value="True">
    																<Setter Property="Fill" TargetName="PageButtonBackground" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
    															</Trigger>
    														</ControlTemplate.Triggers>
    													</ControlTemplate>
    												</Setter.Value>
    											</Setter>
    										</Style>
    									</RepeatButton.Style>
    								</RepeatButton>
    							</Track.IncreaseRepeatButton>
    							<Track.DecreaseRepeatButton>
    								<RepeatButton Command="ScrollBar.PageUpCommand" Opacity="0">
    									<RepeatButton.Style>
    										<Style TargetType="{x:Type RepeatButton}">
    											<Setter Property="OverridesDefaultStyle" Value="True"/>
    											<Setter Property="IsTabStop" Value="False"/>
    											<Setter Property="Focusable" Value="False"/>
    											<Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"/>
    											<Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}"/>
    											<Setter Property="Template">
    												<Setter.Value>
    													<ControlTemplate TargetType="{x:Type RepeatButton}">
    														<Rectangle x:Name="PageButtonBackground" Fill="#00FFFFFF"/>
    														<ControlTemplate.Triggers>
    															<Trigger Property="IsPressed" Value="True">
    																<Setter Property="Fill" TargetName="PageButtonBackground" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
    															</Trigger>
    														</ControlTemplate.Triggers>
    													</ControlTemplate>
    												</Setter.Value>
    											</Setter>
    										</Style>
    									</RepeatButton.Style>
    								</RepeatButton>
    							</Track.DecreaseRepeatButton>
    						</Track>
    						<Viewbox Grid.Row="2" Stretch="Fill" Opacity="0.5">
    							<RepeatButton MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Height="{DynamicResource {x:Static SystemParameters.VerticalScrollBarButtonHeightKey}}" Content="M 0 0 L 3.5 4 L 7 0 Z" Command="ScrollBar.LineDownCommand" Foreground="#FFFFFFFF" Background="#FF374862">
    								<RepeatButton.Style>
    									<Style TargetType="{x:Type RepeatButton}">
    										<Setter Property="OverridesDefaultStyle" Value="True"/>
    										<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
    										<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
    										<Setter Property="BorderBrush">
    											<Setter.Value>
    												<SolidColorBrush/>
    											</Setter.Value>
    										</Setter>
    										<Setter Property="BorderThickness" Value="2,2,2,2"/>
    										<Setter Property="MinWidth" Value="0"/>
    										<Setter Property="MinHeight" Value="0"/>
    										<Setter Property="IsTabStop" Value="False"/>
    										<Setter Property="Focusable" Value="False"/>
    										<Setter Property="Template">
    											<Setter.Value>
    												<ControlTemplate TargetType="{x:Type RepeatButton}">
    													<Microsoft_Windows_Themes1:ClassicBorderDecorator x:Name="ClassicBorder" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="AltRaised" BorderThickness="{TemplateBinding BorderThickness}">
    														<Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}"/>
    													</Microsoft_Windows_Themes1:ClassicBorderDecorator>
    													<ControlTemplate.Triggers>
    														<Trigger Property="IsPressed" Value="True">
    															<Setter Property="BorderStyle" TargetName="ClassicBorder" Value="AltPressed"/>
    														</Trigger>
    														<Trigger Property="IsEnabled" Value="False">
    															<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
    														</Trigger>
    													</ControlTemplate.Triggers>
    												</ControlTemplate>
    											</Setter.Value>
    										</Setter>
    									</Style>
    								</RepeatButton.Style>
    							</RepeatButton>
    						</Viewbox>
    					</Grid>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    		<Style.Triggers>
    			<Trigger Property="Orientation" Value="Horizontal">
    				<Setter Property="Width" Value="NaN"/>
    				<Setter Property="MinWidth" Value="0"/>
    				<Setter Property="Height" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
    				<Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
    				<Setter Property="Template">
    					<Setter.Value>
    						<ControlTemplate TargetType="{x:Type ScrollBar}">
    							<Grid Background="{TemplateBinding Background}">
    								<Grid.ColumnDefinitions>
    									<ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
    									<ColumnDefinition Width="1E-05*"/>
    									<ColumnDefinition MaxWidth="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
    								</Grid.ColumnDefinitions>
    								<Viewbox Stretch="Fill">
    									<RepeatButton MinHeight="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}" Width="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" Content="M 0 4 L 4 8 L 4 0 Z" Command="ScrollBar.LineLeftCommand">
    										<RepeatButton.Style>
    											<Style TargetType="{x:Type RepeatButton}">
    												<Setter Property="OverridesDefaultStyle" Value="True"/>
    												<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
    												<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
    												<Setter Property="BorderBrush">
    													<Setter.Value>
    														<SolidColorBrush/>
    													</Setter.Value>
    												</Setter>
    												<Setter Property="BorderThickness" Value="2,2,2,2"/>
    												<Setter Property="MinWidth" Value="0"/>
    												<Setter Property="MinHeight" Value="0"/>
    												<Setter Property="IsTabStop" Value="False"/>
    												<Setter Property="Focusable" Value="False"/>
    												<Setter Property="Template">
    													<Setter.Value>
    														<ControlTemplate TargetType="{x:Type RepeatButton}">
    															<Microsoft_Windows_Themes1:ClassicBorderDecorator x:Name="ClassicBorder" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="AltRaised" BorderThickness="{TemplateBinding BorderThickness}">
    																<Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}"/>
    															</Microsoft_Windows_Themes1:ClassicBorderDecorator>
    															<ControlTemplate.Triggers>
    																<Trigger Property="IsPressed" Value="True">
    																	<Setter Property="BorderStyle" TargetName="ClassicBorder" Value="AltPressed"/>
    																</Trigger>
    																<Trigger Property="IsEnabled" Value="False">
    																	<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
    																</Trigger>
    															</ControlTemplate.Triggers>
    														</ControlTemplate>
    													</Setter.Value>
    												</Setter>
    											</Style>
    										</RepeatButton.Style>
    									</RepeatButton>
    								</Viewbox>
    								<Rectangle Grid.Column="1">
    									<Rectangle.Fill>
    										<SolidColorBrush Opacity="0.5" Color="#FFFFFFFF"/>
    									</Rectangle.Fill>
    								</Rectangle>
    								<Track x:Name="PART_Track" Grid.Column="1">
    									<Track.Thumb>
    										<Thumb>
    											<Thumb.Style>
    												<Style TargetType="{x:Type Thumb}">
    													<Setter Property="Template">
    														<Setter.Value>
    															<ControlTemplate TargetType="{x:Type Thumb}">
    																<Microsoft_Windows_Themes1:ClassicBorderDecorator Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" BorderStyle="Raised" BorderThickness="3,3,3,3">
    																	<Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
    																		<SolidColorBrush/>
    																	</Microsoft_Windows_Themes1:ClassicBorderDecorator.BorderBrush>
    																</Microsoft_Windows_Themes1:ClassicBorderDecorator>
    															</ControlTemplate>
    														</Setter.Value>
    													</Setter>
    												</Style>
    											</Thumb.Style>
    										</Thumb>
    									</Track.Thumb>
    									<Track.IncreaseRepeatButton>
    										<RepeatButton Command="ScrollBar.PageRightCommand">
    											<RepeatButton.Style>
    												<Style TargetType="{x:Type RepeatButton}">
    													<Setter Property="OverridesDefaultStyle" Value="True"/>
    													<Setter Property="IsTabStop" Value="False"/>
    													<Setter Property="Focusable" Value="False"/>
    													<Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
    													<Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
    													<Setter Property="Template">
    														<Setter.Value>
    															<ControlTemplate TargetType="{x:Type RepeatButton}">
    																<Rectangle x:Name="PageButtonBackground" Fill="#00FFFFFF"/>
    																<ControlTemplate.Triggers>
    																	<Trigger Property="IsPressed" Value="True">
    																		<Setter Property="Fill" TargetName="PageButtonBackground" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
    																	</Trigger>
    																</ControlTemplate.Triggers>
    															</ControlTemplate>
    														</Setter.Value>
    													</Setter>
    												</Style>
    											</RepeatButton.Style>
    										</RepeatButton>
    									</Track.IncreaseRepeatButton>
    									<Track.DecreaseRepeatButton>
    										<RepeatButton Command="ScrollBar.PageLeftCommand">
    											<RepeatButton.Style>
    												<Style TargetType="{x:Type RepeatButton}">
    													<Setter Property="OverridesDefaultStyle" Value="True"/>
    													<Setter Property="IsTabStop" Value="False"/>
    													<Setter Property="Focusable" Value="False"/>
    													<Setter Property="MinHeight" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}"/>
    													<Setter Property="MinWidth" Value="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}"/>
    													<Setter Property="Template">
    														<Setter.Value>
    															<ControlTemplate TargetType="{x:Type RepeatButton}">
    																<Rectangle x:Name="PageButtonBackground" Fill="#00FFFFFF"/>
    																<ControlTemplate.Triggers>
    																	<Trigger Property="IsPressed" Value="True">
    																		<Setter Property="Fill" TargetName="PageButtonBackground" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
    																	</Trigger>
    																</ControlTemplate.Triggers>
    															</ControlTemplate>
    														</Setter.Value>
    													</Setter>
    												</Style>
    											</RepeatButton.Style>
    										</RepeatButton>
    									</Track.DecreaseRepeatButton>
    								</Track>
    								<Viewbox Grid.Column="2" Stretch="Fill">
    									<RepeatButton MinHeight="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarHeightKey}}" Width="{DynamicResource {x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}}" Content="M 0 0 L 0 8 L 4 4 Z" Command="ScrollBar.LineRightCommand">
    										<RepeatButton.Style>
    											<Style TargetType="{x:Type RepeatButton}">
    												<Setter Property="OverridesDefaultStyle" Value="True"/>
    												<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
    												<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
    												<Setter Property="BorderBrush">
    													<Setter.Value>
    														<SolidColorBrush/>
    													</Setter.Value>
    												</Setter>
    												<Setter Property="BorderThickness" Value="2,2,2,2"/>
    												<Setter Property="MinWidth" Value="0"/>
    												<Setter Property="MinHeight" Value="0"/>
    												<Setter Property="IsTabStop" Value="False"/>
    												<Setter Property="Focusable" Value="False"/>
    												<Setter Property="Template">
    													<Setter.Value>
    														<ControlTemplate TargetType="{x:Type RepeatButton}">
    															<Microsoft_Windows_Themes1:ClassicBorderDecorator x:Name="ClassicBorder" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="AltRaised" BorderThickness="{TemplateBinding BorderThickness}">
    																<Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="{TemplateBinding Foreground}" Data="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}"/>
    															</Microsoft_Windows_Themes1:ClassicBorderDecorator>
    															<ControlTemplate.Triggers>
    																<Trigger Property="IsPressed" Value="True">
    																	<Setter Property="BorderStyle" TargetName="ClassicBorder" Value="AltPressed"/>
    																</Trigger>
    																<Trigger Property="IsEnabled" Value="False">
    																	<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
    																</Trigger>
    															</ControlTemplate.Triggers>
    														</ControlTemplate>
    													</Setter.Value>
    												</Setter>
    											</Style>
    										</RepeatButton.Style>
    									</RepeatButton>
    								</Viewbox>
    							</Grid>
    						</ControlTemplate>
    					</Setter.Value>
    				</Setter>
    			</Trigger>
    		</Style.Triggers>
    	</Style>
    	<Style x:Key="ContactListItemStyle" TargetType="{x:Type ListBoxItem}">
            <Setter Property="Background" Value="#00FFFFFF"/>
    		<Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
    		<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}"/>
    		<Setter Property="Padding" Value="2,0,0,0"/>

    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type ListBoxItem}">
    					<ControlTemplate.Resources>
    						<Storyboard x:Key="FadeInContactListItem">
    							<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Bd" Storyboard.TargetProperty="(UIElement.Opacity)">
    								<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
    								<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
    							</DoubleAnimationUsingKeyFrames>
    						</Storyboard>
    						<Storyboard x:Key="GlowContact" AutoReverse="True" RepeatBehavior="3x">
    							<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Bd" Storyboard.TargetProperty="(UIElement.BitmapEffect).(OuterGlowBitmapEffect.Opacity)">
    								<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
    								<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
    							</DoubleAnimationUsingKeyFrames>
    						</Storyboard>
    					</ControlTemplate.Resources>
    					<Border SnapsToDevicePixels="True"  x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">

    						<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
    					</Border>
    					<ControlTemplate.Triggers>
    						<EventTrigger RoutedEvent="FrameworkElement.Loaded">
    							<BeginStoryboard Storyboard="{StaticResource FadeInContactListItem}" x:Name="FadeInContactListItem_BeginStoryboard"/>
    						</EventTrigger>
    						<Trigger Property="IsSelected" Value="True">
    							<Setter Property="Background" TargetName="Bd">
    								<Setter.Value>
    									<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5" Opacity="0.5">
    										<GradientStop Color="#00FFFFFF" Offset="1"/>
    										<GradientStop Color="{Binding Path=DisplayHighlightColour}" Offset="0"/>
    									</LinearGradientBrush>
    								</Setter.Value>
    							</Setter>
    						</Trigger>
    						<MultiTrigger>
    							<MultiTrigger.Conditions>
    								<Condition Property="IsSelected" Value="True"/>
    								<Condition Property="Selector.IsSelectionActive" Value="False"/>
    							</MultiTrigger.Conditions>
    							<Setter Property="Background" TargetName="Bd">
    								<Setter.Value>
    									<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5" Opacity="0.2">
    										<GradientStop Color="#00FFFFFF" Offset="1"/>
    										<GradientStop Color="{Binding Path=DisplayHighlightColour}" Offset="0"/>
    									</LinearGradientBrush>
    								</Setter.Value>
    							</Setter>
    						</MultiTrigger>
    						<Trigger Property="IsEnabled" Value="False">
    							<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
    						</Trigger>

    					</ControlTemplate.Triggers>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<Storyboard x:Key="FadeIn">
    		<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="menu" Storyboard.TargetProperty="(UIElement.Opacity)">
    			<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
    			<SplineDoubleKeyFrame KeyTime="00:00:01.7000000" Value="1"/>
    		</DoubleAnimationUsingKeyFrames>
    		<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
    			<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
    			<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
    		</DoubleAnimationUsingKeyFrames>
    		<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.Opacity)">
    			<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
    			<SplineDoubleKeyFrame KeyTime="00:00:03" Value="1"/>
    		</DoubleAnimationUsingKeyFrames>
    		<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border1" Storyboard.TargetProperty="(UIElement.Opacity)">
    			<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
    			<SplineDoubleKeyFrame KeyTime="00:00:03.3000000" Value="1"/>
    		</DoubleAnimationUsingKeyFrames>
    	</Storyboard>
    	<LinearGradientBrush x:Key="MenuItemSelectionFill" EndPoint="0,1" StartPoint="0,0">
    		<GradientStop Color="#34C5EBFF" Offset="0"/>
    		<GradientStop Color="#3481D8FF" Offset="1"/>
    	</LinearGradientBrush>
    	<Geometry x:Key="Checkmark">M 0,5.1 L 1.7,5.2 L 3.4,7.1 L 8,0.4 L 9.2,0 L 3.3,10.8 Z</Geometry>
    	<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
    		<Grid SnapsToDevicePixels="true">
    			<Rectangle Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="2" RadiusY="2" x:Name="Bg"/>
    			<Rectangle RadiusX="2" RadiusY="2" Margin="1" x:Name="InnerBorder"/>
    			<Grid>
    				<Grid.ColumnDefinitions>
    					<ColumnDefinition MinWidth="24" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup"/>
    					<ColumnDefinition Width="4"/>
    					<ColumnDefinition Width="*"/>
    					<ColumnDefinition Width="37"/>
    					<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup"/>
    					<ColumnDefinition Width="17"/>
    				</Grid.ColumnDefinitions>
    				<ContentPresenter Margin="1" x:Name="Icon" VerticalAlignment="Center" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Icon"/>
    				<Border Margin="1" x:Name="GlyphPanel" Width="22" Height="22" Visibility="Hidden" Background="#FF393939" BorderBrush="#CDD3E6" BorderThickness="1" CornerRadius="3">
    					<Path Fill="#0C12A1" FlowDirection="LeftToRight" x:Name="Glyph" Width="9" Height="11" Data="{StaticResource Checkmark}"/>
    				</Border>
    				<ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.Column="2" ContentSource="Header" RecognizesAccessKey="True" x:Name="contentPresenter"/>
    				<TextBlock Margin="{TemplateBinding Padding}" Grid.Column="4" Text="{TemplateBinding InputGestureText}"/>
    			</Grid>
    		</Grid>
    		<ControlTemplate.Triggers>
    			<Trigger Property="Icon" Value="{x:Null}">
    				<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    			</Trigger>
    			<Trigger Property="IsChecked" Value="true">
    				<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
    				<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    			</Trigger>
    			<Trigger Property="IsHighlighted" Value="true">
    				<Setter Property="BitmapEffect" TargetName="InnerBorder">
    					<Setter.Value>
    						<OuterGlowBitmapEffect/>
    					</Setter.Value>
    				</Setter>
    				<Setter Property="BitmapEffect" TargetName="contentPresenter">
    					<Setter.Value>
    						<OuterGlowBitmapEffect/>
    					</Setter.Value>
    				</Setter>
    			</Trigger>
    			<Trigger Property="IsEnabled" Value="false">
    				<Setter Property="Foreground" Value="#FF9A9A9A"/>
    				<Setter Property="Background" TargetName="GlyphPanel" Value="#EEE9E9"/>
    				<Setter Property="BorderBrush" TargetName="GlyphPanel" Value="#DBD6D6"/>
    				<Setter Property="Fill" TargetName="Glyph" Value="#848589"/>
    			</Trigger>
    		</ControlTemplate.Triggers>
    	</ControlTemplate>
    	<LinearGradientBrush x:Key="MenuItemPressedFill" EndPoint="0,1" StartPoint="0,0">
    		<GradientStop Color="#28717070" Offset="0"/>
    		<GradientStop Color="#50717070" Offset="0.75"/>
    		<GradientStop Color="#90717070" Offset="1"/>
    	</LinearGradientBrush>
    	<Style x:Key="MenuScrollButton" BasedOn="{x:Null}" TargetType="{x:Type RepeatButton}">
    		<Setter Property="ClickMode" Value="Hover"/>
    		<Setter Property="MinWidth" Value="0"/>
    		<Setter Property="MinHeight" Value="0"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type RepeatButton}">
    					<DockPanel SnapsToDevicePixels="true" Background="Transparent">
    						<Rectangle Fill="Transparent" x:Name="R1" Width="1" DockPanel.Dock="Right"/>
    						<Rectangle Fill="Transparent" x:Name="B1" Height="1" DockPanel.Dock="Bottom"/>
    						<Rectangle Fill="Transparent" x:Name="L1" Width="1" DockPanel.Dock="Left"/>
    						<Rectangle Fill="Transparent" x:Name="T1" Height="1" DockPanel.Dock="Top"/>
    						<ContentPresenter HorizontalAlignment="Center" Margin="2,2,2,2" x:Name="ContentContainer" VerticalAlignment="Center"/>
    					</DockPanel>
    					<ControlTemplate.Triggers>
    						<Trigger Property="IsPressed" Value="true">
    							<Setter Property="Fill" TargetName="R1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
    							<Setter Property="Fill" TargetName="B1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
    							<Setter Property="Fill" TargetName="L1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
    							<Setter Property="Fill" TargetName="T1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
    							<Setter Property="Margin" TargetName="ContentContainer" Value="3,3,1,1"/>
    						</Trigger>
    					</ControlTemplate.Triggers>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<Geometry x:Key="UpArrow">M 0,4 L 3.5,0 L 7,4 Z</Geometry>
    	<MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
    	<Geometry x:Key="DownArrow">M 0,0 L 3.5,4 L 7,0 Z</Geometry>
    	<Style x:Key="{ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}" BasedOn="{x:Null}" TargetType="{x:Type ScrollViewer}">
    		<Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
    		<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type ScrollViewer}">
    					<Grid SnapsToDevicePixels="true">
    						<Grid.ColumnDefinitions>
    							<ColumnDefinition Width="*"/>
    						</Grid.ColumnDefinitions>
    						<Grid.RowDefinitions>
    							<RowDefinition Height="Auto"/>
    							<RowDefinition Height="*"/>
    							<RowDefinition Height="Auto"/>
    						</Grid.RowDefinitions>
    						<Border Grid.Column="0" Grid.Row="1">
    							<ScrollContentPresenter Margin="{TemplateBinding Padding}"/>
    						</Border>
    						<RepeatButton Style="{StaticResource MenuScrollButton}" Focusable="false" Grid.Column="0" Grid.Row="0" Command="{x:Static ScrollBar.LineUpCommand}" >
    							<RepeatButton.Visibility>
    								<MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
    									<Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
    									<Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
    									<Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
    									<Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
    								</MultiBinding>
    							</RepeatButton.Visibility>
    							<Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" Data="{StaticResource UpArrow}"/>
    						</RepeatButton>
    						<RepeatButton Style="{StaticResource MenuScrollButton}" Focusable="false" Grid.Column="0" Grid.Row="2" Command="{x:Static ScrollBar.LineDownCommand}" >
    							<RepeatButton.Visibility>
    								<MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
    									<Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
    									<Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
    									<Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
    									<Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
    								</MultiBinding>
    							</RepeatButton.Visibility>
    							<Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" Data="{StaticResource DownArrow}"/>
    						</RepeatButton>
    					</Grid>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}" TargetType="{x:Type ContentControl}">
    		<Border BorderBrush="#FF959595" BorderThickness="1" Background="#669B9191" CornerRadius="10,10,10,10">
    			<Border.BitmapEffect>
    				<OuterGlowBitmapEffect GlowColor="#FFA7A7A7" Opacity="0.4"/>
    			</Border.BitmapEffect>
    			<Grid>
    				<Rectangle RadiusX="2" RadiusY="2" HorizontalAlignment="Left" Margin="2" Width="28"/>
    				<Rectangle HorizontalAlignment="Left" Margin="30,2,0,2" Width="1"/>
    				<Rectangle HorizontalAlignment="Left" Margin="31,2,0,2" Width="1"/>
    				<ContentPresenter Margin="1,0" Grid.ColumnSpan="2"/>
    			</Grid>
    		</Border>
    	</ControlTemplate>
    	<Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>
    	<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
    		<Grid SnapsToDevicePixels="true">
    			<Rectangle Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="2" RadiusY="2" x:Name="Bg"/>
    			<Rectangle Stroke="Transparent" StrokeThickness="1" RadiusX="2" RadiusY="2" Margin="1" x:Name="InnerBorder"/>
    			<Grid>
    				<Grid.ColumnDefinitions>
    					<ColumnDefinition MinWidth="24" Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup"/>
    					<ColumnDefinition Width="4"/>
    					<ColumnDefinition Width="*"/>
    					<ColumnDefinition Width="37"/>
    					<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIGTColumnGroup"/>
    					<ColumnDefinition Width="17"/>
    				</Grid.ColumnDefinitions>
    				<ContentPresenter Margin="1" x:Name="Icon" VerticalAlignment="Center" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Icon"/>
    				<Border Margin="1" x:Name="GlyphPanel" Width="22" Height="22" Visibility="Hidden" Background="#E6EFF4" BorderBrush="#CDD3E6" BorderThickness="1" CornerRadius="3">
    					<Path Fill="#0C12A1" FlowDirection="LeftToRight" x:Name="Glyph" Width="9" Height="11" Data="{StaticResource Checkmark}"/>
    				</Border>
    				<ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.Column="2" ContentSource="Header" RecognizesAccessKey="True"/>
    				<TextBlock Margin="{TemplateBinding Padding}" Visibility="Collapsed" Grid.Column="4" Text="{TemplateBinding InputGestureText}"/>
    				<Path Fill="{TemplateBinding Foreground}" Margin="4,0,0,0" VerticalAlignment="Center" Grid.Column="5" Data="{StaticResource RightArrow}"/>
    			</Grid>
    			<Popup x:Name="PART_Popup" AllowsTransparency="true" HorizontalOffset="-2" IsOpen="{Binding Path=IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" VerticalOffset="-3" Focusable="false">
    				<Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
    					<ContentControl x:Name="SubMenuBorder" IsTabStop="false" Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}}">
    						<ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="true">
    							<ItemsPresenter Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.IsSharedSizeScope="true" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle"/>
    						</ScrollViewer>
    					</ContentControl>
    				</Microsoft_Windows_Themes:SystemDropShadowChrome>
    			</Popup>
    		</Grid>
    		<ControlTemplate.Triggers>
    			<Trigger Property="IsSuspendingPopupAnimation" Value="true">
    				<Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
    			</Trigger>
    			<Trigger Property="IsHighlighted" Value="true">
    				<Setter Property="Stroke" TargetName="InnerBorder" Value="#D1DBF4FF"/>
    			</Trigger>
    			<Trigger Property="Icon" Value="{x:Null}">
    				<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    			</Trigger>
    			<Trigger Property="IsChecked" Value="true">
    				<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
    				<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
    			</Trigger>
    			<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
    				<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
    				<Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
    			</Trigger>
    			<Trigger Property="IsHighlighted" Value="true">
    				<Setter Property="Fill" TargetName="Bg" Value="{StaticResource MenuItemSelectionFill}"/>
    				<Setter Property="Stroke" TargetName="Bg" Value="#8571CBF1"/>
    			</Trigger>
    			<Trigger Property="IsEnabled" Value="false">
    				<Setter Property="Foreground" Value="#FF9A9A9A"/>
    				<Setter Property="Background" TargetName="GlyphPanel" Value="#EEE9E9"/>
    				<Setter Property="BorderBrush" TargetName="GlyphPanel" Value="#DBD6D6"/>
    				<Setter Property="Fill" TargetName="Glyph" Value="#848589"/>
    			</Trigger>
    		</ControlTemplate.Triggers>
    	</ControlTemplate>
    	<Style x:Key="MenuItemStyle1" TargetType="{x:Type MenuItem}">
    		<Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    		<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
    		<Setter Property="Background" Value="Transparent"/>
    		<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
    		<Style.Triggers>
    			<Trigger Property="Role" Value="TopLevelHeader"/>
    			<Trigger Property="Role" Value="TopLevelItem"/>
    			<Trigger Property="Role" Value="SubmenuHeader">
    				<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
    			</Trigger>
    			<Trigger Property="Role" Value="SubmenuItem"/>
    		</Style.Triggers>
    	</Style>
        
    </Window.Resources>
	<Window.Triggers>
		<EventTrigger RoutedEvent="FrameworkElement.Loaded">
			<BeginStoryboard Storyboard="{StaticResource FadeIn}" x:Name="FadeIn_BeginStoryboard"/>
		</EventTrigger>
	</Window.Triggers>
	<Window.Background>
		<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
			<GradientStop Color="#FF000000" Offset="1"/>
			<GradientStop Color="#FF000000" Offset="0"/>
			<GradientStop Color="#FF5A8EA2" Offset="0.5"/>
		</LinearGradientBrush>
	</Window.Background>
    <Grid x:Name="grid">
        <Grid.RowDefinitions>
            <RowDefinition Height="25" />
            <RowDefinition Height="152*" />
            <RowDefinition Height="3"/>
            <RowDefinition Height="103*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" MinWidth="150"  />
            <ColumnDefinition Width="3" />
            <ColumnDefinition Width="200*" />
        </Grid.ColumnDefinitions>
        <Menu Grid.ColumnSpan="3" Background="Transparent" x:Name="menu">
            <MenuItem Header="System" Foreground="White" Click="MenuItem_Click_2" >
            	<MenuItem Header="MenuItem"/>
            </MenuItem>
            <MenuItem Header="Tools" Foreground="White" Click="MenuItem_Click">
                <MenuItem Header="Options" Foreground="White" Click="MenuItem_Click_3" BorderThickness="0" ItemContainerStyle="{DynamicResource MenuItemStyle1}" Style="{DynamicResource MenuItemStyle1}" HorizontalContentAlignment="Left" Padding="0,0,0,0" VerticalContentAlignment="Top" />
            	<MenuItem Header="MenuItem"/>
            </MenuItem>

            <MenuItem Header="About" Foreground="White" Click="MenuItem_Click_1" />
        </Menu>
        <Border Grid.Row="1" Grid.RowSpan="3" BorderThickness="0,0,0,0" BorderBrush="#FF4F7B9F" Margin="5,2,2,2" CornerRadius="5,5,5,5" x:Name="border">
        	<Border.Background>
        		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        			<GradientStop Color="#FF000000" Offset="0"/>
        			<GradientStop Color="#FF7B8A95" Offset="1"/>
        		</LinearGradientBrush>
        	</Border.Background>
        	<Border.BitmapEffect>
        		<DropShadowBitmapEffect Color="#FF464D4C" ShadowDepth="10"/>
        	</Border.BitmapEffect>
            
            <Grid Height="Auto" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="25" />                            
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Text="Contacts" TextTrimming="CharacterEllipsis" FontSize="20">
                	<TextBlock.Foreground>
                		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                			<GradientStop Color="#FFF5F5F5" Offset="0"/>
                			<GradientStop Color="#FF708DAB" Offset="1"/>
                		</LinearGradientBrush>
                	</TextBlock.Foreground>
            	    <TextBlock.BitmapEffect>
            		    <OuterGlowBitmapEffect GlowColor="#FF4283C6" GlowSize="6"/>
            	    </TextBlock.BitmapEffect>                
                </TextBlock>          
                <ScrollViewer Grid.Row="1" IsEnabled="True"  x:Name="Scroller" Visibility="Visible" VerticalScrollBarVisibility="Auto" Template="{DynamicResource ScrollViewerControlTemplate1}">
                    <ListBox  ScrollViewer.VerticalScrollBarVisibility="Hidden" IsSynchronizedWithCurrentItem="True"  x:Name="_contactListView"  BorderThickness="0" Grid.Row="1" Grid.RowSpan="3" Background="Transparent" Foreground="Wheat" ItemContainerStyle="{DynamicResource ContactListItemStyle}" >
                    	<ListBox.ItemTemplate>
                    		<StaticResource ResourceKey="ContactListTemplate"/>
                    	</ListBox.ItemTemplate>
                    </ListBox>
                </ScrollViewer>  
            </Grid>
            
        </Border>
        <GridSplitter ResizeDirection="Columns" Grid.Column="1" Grid.Row="1" Grid.RowSpan="3" ResizeBehavior="PreviousAndNext" Width="3" Background="#0068717D"  />
        <Border Margin="2,2,2,2" Grid.ColumnSpan="1" Grid.Row="1" Grid.RowSpan="3" CornerRadius="5,5,5,5" Grid.Column="2" x:Name="border1">
        	<Border.BitmapEffect>
        		<DropShadowBitmapEffect Color="#FF4B4B4B" ShadowDepth="15"/>
        	</Border.BitmapEffect>

        	<TabControl x:Name="_tabControl" BorderThickness="0,0,0,0"  Background="Black" BorderBrush="Black" Foreground="AliceBlue"  Width="Auto" Height="Auto" Padding="0" TabStripPlacement="Top">
        		<TabControl.Resources>
        			<Style TargetType="{x:Type TabItem}">
                        <Style.Triggers>

                        </Style.Triggers>
                        <Setter Property="IsSelected" Value="{Binding Path=IsTabSelected, Mode=TwoWay}"/>                        
        				<Setter Property="Template">
        					<Setter.Value>
        						<ControlTemplate TargetType="{x:Type TabItem}">
        							<ControlTemplate.Resources>
                                        
                                        <SolidColorBrush x:Key="NormalBrush" Color="{Binding Path=TabHeaderColour}" />
                                        <SolidColorBrush x:Key="GlowBrush" Color="Orange" />
                                        
                                        <Storyboard x:Key="OnLoaded1" Duration="00:00:01" RepeatBehavior="2x" AutoReverse="True" FillBehavior="Stop">                                        
        									<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Border" Storyboard.TargetProperty="(UIElement.Opacity)">
        										<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
        										<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
        									</DoubleAnimationUsingKeyFrames>                                        
        								</Storyboard>   
                                    </ControlTemplate.Resources>
        							<Grid Height="Auto" x:Name="grid" Panel.ZIndex="0">
        								<Grid.ColumnDefinitions>
        									<ColumnDefinition Width="0.896*"/>
        									<ColumnDefinition Width="0.104*"/>
        								</Grid.ColumnDefinitions>
        								<Border x:Name="Border" BorderBrush="Black" BorderThickness="1,1,1,1" CornerRadius="6,6,0,0" Grid.ColumnSpan="2" >
        									<Border.Background>
        										<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        											<GradientStop Color="#FF000000" Offset="0" x:Name="TabGradientStop"/>
        											<GradientStop Color="{Binding Path=TabHeaderColour}" Offset="1"/>
        										</LinearGradientBrush>
        									</Border.Background>
                                            <Border.BitmapEffect>
                                                <OuterGlowBitmapEffect GlowColor="Orange" Opacity="0" GlowSize="20"/>
                                            </Border.BitmapEffect>
        									<Grid >
        										<Grid.ColumnDefinitions>
        											<ColumnDefinition Width="*"/>
        											<ColumnDefinition Width="25"/>
        										</Grid.ColumnDefinitions>
        										<ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Left" ContentSource="Header" Margin="10,0,0,0" RenderTransformOrigin="0.5,0.5" d:LayoutOverrides="Height" >
        											<ContentPresenter.RenderTransform>
        												<TransformGroup>
        													<ScaleTransform ScaleX="1" ScaleY="1"/>
        													<SkewTransform AngleX="0" AngleY="0"/>
        													<RotateTransform Angle="0"/>
        													<TranslateTransform X="0" Y="0"/>
        												</TransformGroup>
        											</ContentPresenter.RenderTransform>
        										</ContentPresenter>
        									</Grid>
                                        </Border>
        								<Viewbox Visibility="{Binding Path=CloseButtonVisibility}" Tag="{Binding Path=OutgoingTBName}" HorizontalAlignment="Right" Margin="0,2.421,3.232,0" VerticalAlignment="Top" Width="9" Height="7.611" Grid.Column="1" Stretch="Fill" x:Name="viewbox" MouseDown="viewbox_MouseDown">
        									<Grid Width="9" Height="7.611">
        										<Path  Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FFFFFFFF" Margin="0.294,0.361,0.456,0" x:Name="path" Data="M121.43736,-5.0155662 L109.68736,5.4844338"/>
        										<Path  Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FFFFFFFF" Margin="0,0,0,0.111" x:Name="path1" Data="M143.95215,8.8858111 L151.95215,15.385811"/>
        									</Grid>
        								</Viewbox>
        							</Grid>
        							<ControlTemplate.Triggers>
        								<Trigger Property="Selector.IsSelected" Value="False">
        									<Setter Property="Opacity" TargetName="ContentSite" Value="0.6"/>   
                                            
        								</Trigger>
        								<Trigger Property="IsMouseOver" Value="True">                                            
                                            <Setter Property="BitmapEffect" TargetName="ContentSite">
                                                <Setter.Value>
                                                    <OuterGlowBitmapEffect Opacity="{Binding Path=TabOpacity}"/>
                                                </Setter.Value>
                                            </Setter>
                                            <Setter Property="BitmapEffect" TargetName="viewbox">
                                                <Setter.Value>
                                                    <OuterGlowBitmapEffect GlowColor="Red" GlowSize="4" />
                                                </Setter.Value>
                                            </Setter>

                                        </Trigger>
        								<Trigger Property="Selector.IsSelected" Value="True">
        									<Setter Property="BitmapEffect" TargetName="Border">
        										<Setter.Value>
        											<OuterGlowBitmapEffect GlowColor="{Binding Path=TabHeaderColour}" Opacity="{Binding Path=TabOpacity}" GlowSize="15"/>
        										</Setter.Value>
        									</Setter>
        									<Setter Property="BitmapEffect" TargetName="ContentSite">
        										<Setter.Value>
        											<OuterGlowBitmapEffect/>
        										</Setter.Value>
        									</Setter>

        								</Trigger>
                                        <DataTrigger Binding="{Binding Path=FlashTab}" Value="True"   >
                                            <Setter Property="Background" TargetName="Border">
                                                <Setter.Value>
                                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                        <GradientStop Color="#FF000000" Offset="0" />
                                                        <GradientStop Color="{Binding Path=TabHeaderColour}" Offset="1"/>
                                                    </LinearGradientBrush>
                                                </Setter.Value>
                                            </Setter>
                                            <DataTrigger.EnterActions>

                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Duration="00:00:1.75" AutoReverse="False" Storyboard.TargetName="Border"   Storyboard.TargetProperty="(UIElement.BitmapEffect).(OuterGlowBitmapEffect.Opacity)">
                                                            <LinearDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:0.25" Value="1"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:0.5" Value="0"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:0.75" Value="1"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:1" Value="0"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:1.25" Value="1"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:1.5" Value="0"/>
                                                            <LinearDoubleKeyFrame KeyTime="00:00:1.75" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </DataTrigger.EnterActions>
                                        </DataTrigger>
        							</ControlTemplate.Triggers>
        						</ControlTemplate>
        					</Setter.Value>
        				</Setter>
        				<Setter Property="Foreground" Value="White"/>
        				<Setter Property="Height" Value="20"/>
        			</Style>
        		</TabControl.Resources>
        		<TabControl.BitmapEffect>
        			<DropShadowBitmapEffect ShadowDepth="10" Color="#FF565151"/>
        		</TabControl.BitmapEffect>

        		<TabControl.ItemTemplate>
        			<DataTemplate>
                        <TextBlock ToolTip="{Binding Path=TabHeaderText}"  Text="{Binding Path=TabHeaderText}" TextTrimming="CharacterEllipsis" MaxWidth="100" x:Name="textBlock" Opacity="{Binding Path=TabOpacity}" />
                    </DataTemplate>
        		</TabControl.ItemTemplate>

        		<TabControl.ContentTemplate >
        			<DataTemplate>
        				<Grid>
        					<Grid.ColumnDefinitions>
        						<ColumnDefinition Width="*"/>
        					</Grid.ColumnDefinitions>
        					<Grid.RowDefinitions>
        						<RowDefinition Height="151*" />
        						<RowDefinition Height="3"/>
        						<RowDefinition Height="90*" />
        					</Grid.RowDefinitions>

        					<src:BindableRichTextBox Document="{Binding Path=MessageDoc}" VerticalScrollBarVisibility="Auto" BorderThickness="0,0,0,0" TextChanged="BindableRichTextBox_TextChanged" Background="#FFF9F3F3">
        						<src:BindableRichTextBox.Resources>
        							<Style TargetType="{x:Type ScrollViewer}">
        								<Setter Property="Template" Value="{StaticResource ScrollViewerControlTemplate1}"/>
        							</Style>
        						</src:BindableRichTextBox.Resources>
        					</src:BindableRichTextBox>

        					<!--<ScrollViewer  Style="{StaticResource myStyle}" x:Name="Scroller">
                            <ListBox BorderThickness="0"  VirtualizingStackPanel.IsVirtualizing="False" IsSynchronizedWithCurrentItem="True" SelectionChanged="ListBox_SelectionChanged"  Tag="{Binding Path=IncomingListName}" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" ItemsSource="{Binding Path=IncomingMessages, NotifyOnSourceUpdated=True}" ItemTemplate="{StaticResource mainTemplate}">
                                <ListBox.Background>
                                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                        <GradientStop Color="White" Offset="0"/>
                                        <GradientStop Color="#FF68717D" Offset="1.6"/>
                                        <GradientStop Color="#FF68717D" Offset="1"/>
                                    </LinearGradientBrush>
                                </ListBox.Background>

                            </ListBox>
                        </ScrollViewer>-->
        					<GridSplitter   ResizeDirection="Rows"  Grid.Row="1" HorizontalAlignment="Stretch" ResizeBehavior="PreviousAndNext" Height="3"  VerticalAlignment="Top"  >
        						<GridSplitter.Background>
        							<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
        								<GradientStop Color="White" Offset="0"/>
        								<GradientStop Color="LightSteelBlue" Offset="1.6"/>
        								<GradientStop Color="#FFFBFDFF" Offset="1"/>
        								<GradientStop Color="#FF657B96" Offset="0.504"/>
        							</LinearGradientBrush>
        						</GridSplitter.Background>

        					</GridSplitter>

        					<src:BindableRichTextBox SpellCheck.IsEnabled="True" Tag="{Binding Path=OutgoingTBName}" Document="{Binding Path=OutgoingText, Mode=TwoWay}"  Grid.Row="2" BorderThickness="0,0,0,0"  VerticalScrollBarVisibility="Auto" KeyUp="TextBox_KeyUp" IsDocumentEnabled="True" Foreground="Khaki">
        						<src:BindableRichTextBox.Resources>
        							<Style TargetType="{x:Type ScrollViewer}">
        								<Setter Property="Template" Value="{StaticResource ScrollViewerControlTemplate1}"/>
        							</Style>
        						</src:BindableRichTextBox.Resources>
        						<src:BindableRichTextBox.Background>
        							<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
        								<GradientStop Color="White" Offset="0"/>
        								<GradientStop Color="LightSteelBlue" Offset="1.6"/>
        								<GradientStop Color="#FFF9F9F9" Offset="1"/>
        							</LinearGradientBrush>
        						</src:BindableRichTextBox.Background>
        					</src:BindableRichTextBox>
        				</Grid>
        			</DataTemplate>
        		</TabControl.ContentTemplate>


        	</TabControl>


        </Border>


    </Grid>

</Window>